<%-- 
    Document   : upload
    Created on : Mar 3, 2009, 3:17:35 AM
    Author     : yongchao
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="pku.lbs.web.*, pku.lbs.web.utils.*" %>
<script type="text/javascript" src="scripts/prototype/prototype.js"></script>
<script type="text/javascript" src="scripts/gc_global.js"></script>
<script type="text/javascript" src="scripts/gc_util.js"></script>
<%
    String initData = UploadWeb.getInstance().doSendFile(request, response);
    initData = (initData == null ? "" : Tools.encodeBase64(initData));
    String flag = request.getParameter("type");
    flag = (flag == null ? "" : Tools.encodeBase64(flag));
%>
<script type="text/javascript">
    function initPage(){
        var initData = '<%= initData %>';
        initData = (initData == '' ? '' : Base64.decode( initData ).evalJSON( true ));
        var flag = '<%= flag %>';
        flag = (flag == '' ? '' : Base64.decode( flag ).evalJSON( true ));

        if(!(typeof initData.RETURN == 'undefined')){
            if( initData.RETURN ) {
                if (flag == 0) {
                    parent.document.getElementById('upload_message').innerHTML = '文件上传成功';
                    parent.document.getElementById('upload_message').className = 'ok_message';
                    parent.document.getElementById('upload_message').innerHTML = '';
                    parent.document.getElementById('upload_message').className = '';
                    parent.document.getElementById('send_file_dialog').hide();
                } else {
                    parent.document.getElementById('single_upload_message').innerHTML = '文件上传成功';
                    parent.document.getElementById('single_upload_message').className = 'ok_message';
                    parent.document.getElementById('single_upload_message').innerHTML = '';
                    parent.document.getElementById('single_upload_message').className = '';
                    parent.document.getElementById('send_single_file_dialog').hide();
                }
            } else {
                var message = initData.MESSAGE;
                if (flag == 0) {
                    parent.document.getElementById('upload_message').innerHTML = message;
                    parent.document.getElementById('upload_message').className = 'wrong_message';
                } else {
                    parent.document.getElementById('single_upload_message').innerHTML = message;
                    parent.document.getElementById('single_upload_message').className = 'wrong_message';
                }
            }
        }
    }
</script>
